﻿package engine.systems.collision.collision
{
	import ash.core.Entity;
	
	import ash.core.Component;
	
	import flash.utils.Dictionary;
	
	import org.osflash.signals.Signal;
	
	public class Collision extends Component
	{
		public var type:String;
		public var types:Dictionary = new Dictionary();
		
		public var precise:Boolean;
		
		public var collided:Signal = new Signal(Entity, Entity);
		
		public function Collision(precise:Boolean = false, type:String = "default", types:Array = null)
		{
			this.precise 	= precise;
			this.type 		= type;
			
			if(types)
			{
				for each(var string:String in types)
					this.types[string] = true;
			}
			else this.types["default"] = true;
		}
		
		override public function destroy():void
		{
			this.types = null;
			
			this.collided.removeAll();
			this.collided = null;
		}
	}
}